<template>
	<view style="height: 400rpx;"><qiun-data-charts type="column" :opts="opt" :chartData="chartData" background="none" /></view>
</template>

<script>
export default {
	props: {
		acc: {
			type: Array | Object,
			default() {
				return null;
			}
		}
	},
	data() {
		return {
			chartData: {}
		};
	},
	watch: {
		acc(newValue, oldValue) {
			this.init();
		}
	},
	created() {
		this.init();
	},
	methods: {
		init() {
			if (this.acc) {
				let chartData = {
					categories: ['专户数', '拨付金额', '发放金额', '专户余额'], // 累积金额
					series: [
						{
							name: '专户统计',
							data: [
								{
									value: this.acc.account,
									color: '#13A4FE',
								},
								{
									value: this.acc.disburse,
									color: '#C2CCD8'
								},
								{
									value: this.acc.salary,
									color: '#FFB61D'
								},
								{
									value: this.acc.balance,
									color: '#21D6F3'
								}
							]
						}
					]
				};
				this.chartData = chartData;
			} else {
				this.chartData = {};
				console.error('项目管理', '项目情况无数据');
			}
		}
	},
	computed: {
		opt() {
			return {
				legend: {
					show: false
				}
			};
		}
	}
};
</script>

<style></style>
